<?php

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

/**
* @package		Joomla
* @subpackage	Hotel
*/
class HTML_hotel
{
        function showConsumiveis( &$rows, &$pageNav, $option, &$lists )
	{
		$user =& JFactory::getUser();
                $view = JRequest::getcmd('view');

		//Ordering allowed ?
		//$ordering = ($lists['order'] == 'cd.ordering');

		JHTML::_('behavior.tooltip');
		?>
		<form action="index.php?option=com_hotel" method="post" name="adminForm">

		<table>
		<tr>
			<td align="left" width="100%">
				<?php echo JText::_( 'Filter' ); ?>:
				<input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
				<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php
				//echo $lists['catid'];
				echo $lists['state'];
				?>
			</td>
		</tr>
		</table>

			<table class="adminlist">
			<thead>
				<tr>
					<th width="10">
						<?php echo JText::_( 'Num' ); ?>
					</th>
					<th width="10" class="title">
						<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" />
					</th>
					<th class="title">
						<?php echo JHTML::_('grid.sort',   'Descrição', 'cd.descricao',NULL,NULL ); ?>
					</th>
					<th width="5%" class="title" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Tipo', 'cd.tipo',NULL,NULL  ); ?>
					</th>
					
					<th width="8%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Valor', 'cd.valor',NULL,NULL  ); ?>
					</th>
					
					<th width="1%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'ID', 'cd.id',NULL,NULL  ); ?>
					</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="11">
						<?php echo $pageNav->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
			<?php
			$k = 0;
			for ($i=0, $n=count($rows); $i < $n; $i++) {
				$row = $rows[$i];

				$link 		= JRoute::_( 'index.php?option=com_hotel&task=edit&cid[]='. $row->id.'&view='.$view );

				$checked 	= JHTML::_('grid.checkedout',   $row, $i );
				$access 	= JHTML::_('grid.access',   $row, $i );
				//$published 	= JHTML::_('grid.published', $row, $i );
                                if($row->tipo=='P'){
                                    $published = "Produto";
                                }else{
                                    $published = "Serviço";
                                }
				$row->cat_link 	= JRoute::_( 'index.php?option=com_categories&section=com_hotel_details&task=edit&type=other&cid[]='. $row->catid );
				$row->user_link	= JRoute::_( 'index.php?option=com_users&task=editA&cid[]='. $row->user_id );
				?>
				<tr class="<?php echo "row$k"; ?>">
					<td>
						<?php echo $pageNav->getRowOffset( $i ); ?>
					</td>
					<td>
						<?php echo $checked; ?>
					</td>
					<td>
					<?php
					if (JTable::isCheckedOut($user->get ('id'), $row->checked_out )) :
						echo htmlspecialchars($row->descricao);
					else :
						?>
						<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Hotel' );?>::<?php echo htmlspecialchars($row->name); ?>">
						<a href="<?php echo $link; ?>">
							<?php echo htmlspecialchars($row->descricao); ?></a> </span>
						<?php
					endif;
					?>
					</td>
					<td align="center">
                                            
						<?php echo $published;?>
					</td>
					
					<td align="center">
						<?php echo "R$ ".$row->valor;?>
					</td>
					
					<td align="center">
						<?php echo $row->id; ?>
					</td>
				</tr>
				<?php
				$k = 1 - $k;
			}
			?>
			</tbody>
			</table>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />
		<input type="hidden" name="task" value="" />
                <input type="hidden" name="view" value="consumiveis" />
		<input type="hidden" name="boxchecked" value="0" />
		
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}

        function showOcupacoes( &$rows, &$pageNav, $option, &$lists )
	{
		$user =& JFactory::getUser();
                $view = JRequest::getcmd('view');

		//Ordering allowed ?
		$ordering = ($lists['order'] == 'cd.ordering');

		JHTML::_('behavior.tooltip');
		?>
		<form action="index.php?option=com_hotel" method="post" name="adminForm">

		<table>
		<!-- <tr>
			<td align="left" width="100%">
				<?php echo JText::_( 'Filter' ); ?>:
				<input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
				<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php
				//echo $lists['catid'];
				//echo $lists['state'];
				?>
			</td>
		</tr> -->
		</table>

			<table class="adminlist">
			<thead>
				<tr>
					<th width="2%">
						<?php echo JText::_( 'Num' ); ?>
					</th>
					<th width="2%" class="title">
						<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" />
					</th>
                                        <th width="10%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Apto', 'oc.numApto',NULL,NULL  ); ?>
					</th>
                                        <th width="50%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Cliente', 'c.name',NULL,NULL  ); ?>
					</th>
					<th width="5%" class="title">
						<?php echo JHTML::_('grid.sort',   'Data Entrada', 'oc.dataEntrada',NULL,NULL ); ?>
					</th>
					<th width="5%" class="title" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Data Saida', 'oc.dataSaida',NULL,NULL  ); ?>
					</th>

					<th width="10%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Num. Pessoas', 'oc.qtdePessoas',NULL,NULL  ); ?>
					</th>
                                        

					
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="11">
						<?php echo $pageNav->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
			<?php
			$k = 0;
			for ($i=0, $n=count($rows); $i < $n; $i++) {
				$row = $rows[$i];

				$link 		= JRoute::_( 'index.php?option=com_hotel&task=edit&cid[]='. $row->id.'&view='.$view );

				$checked 	= JHTML::_('grid.checkedout',   $row, $i );
				$access 	= JHTML::_('grid.access',   $row, $i );
				//$published 	= JHTML::_('grid.published', $row, $i );
                                
				//$row->cat_link 	= JRoute::_( 'index.php?option=com_categories&section=com_hotel_details&task=edit&type=other&cid[]='. $row->catid );
				$row->user_link	= JRoute::_( 'index.php?option=com_users&task=editA&cid[]='. $row->user_id );
				?>
				<tr class="<?php echo "row$k"; ?>">
					<td>
						<?php echo $pageNav->getRowOffset( $i ); ?>
					</td>
					<td>
						<?php echo $checked; ?>
					</td>
                                        <td align="center">
                                        <?php
					if (JTable::isCheckedOut($user->get ('id'), $row->checked_out )) :
						echo htmlspecialchars($row->numApto);
					else :
						?>
						<span class="editlinktip hasTip" title="<?php echo JText::_( 'Editar Ocupacao' );?>::<?php echo htmlspecialchars($row->numApto); ?>">
						<a href="<?php echo $link; ?>">
							<?php echo "apto Nº ".htmlspecialchars($row->numApto); ?></a> </span>
						<?php
					endif;
					?>
                                        
					
					</td>
                                         <td align="center">

						<?php echo $row->name;?>
					</td>
					<td>
                                            <?php
                                                //$data = date_create($row->dataEntrada);
                                                //$data = date_format($data, 'd/m/Y');

                                            ?>
                                            <?php echo $row->dataEntrada;?>
					</td>
					<td align="center">
                                                <?php
                                                //$data = date_create($row->dataSaida);
                                                //$data = date_format($data, 'd/m/Y');
                                                ?>
						<?php if($row->dataSaida == '') :echo "ocupado"; else: echo $row->dataSaida; endif;?>
					</td> 

					<td align="center">
						<?php echo $row->qtdePessoas;?>
					</td>

					
                                       
				</tr>
				<?php
				$k = 1 - $k;
			}
			?>
			</tbody>
			</table>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />
		<input type="hidden" name="task" value="" />
                <input type="hidden" name="view" value="ocupacoes" />
		<input type="hidden" name="boxchecked" value="0" />

		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}

        function showReservas( &$rows, &$pageNav, $option, &$lists )
	{
               
                $user =& JFactory::getUser();
                $view = JRequest::getcmd('view');

		//Ordering allowed ?
		$ordering = ($lists['order'] == 'cd.ordering');

		JHTML::_('behavior.tooltip');
		?>
		<form action="index.php?option=com_hotel" method="post" name="adminForm">

		<table>
		<!-- <tr>
			<td align="left" width="100%">
				<?php echo JText::_( 'Filter' ); ?>:
				<input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
				<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php
				//echo $lists['catid'];
				//echo $lists['state'];
				?>
			</td>
		</tr> -->
		</table>

			<table class="adminlist">
			<thead>
				<tr>
					<th width="2%">
						<?php echo JText::_( 'Num' ); ?>
					</th>
					<th width="2%" class="title">
						<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" />
					</th>
                                        <th width="10%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Apto', 're.numapto',NULL,NULL  ); ?>
					</th>
                                        <th width="50%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Cliente', 'c.name',NULL,NULL  ); ?>
					</th>
					<th width="5%" class="title">
						<?php echo JHTML::_('grid.sort',   'Data Reserva', 're.dataReserva',NULL,NULL ); ?>
					</th>
					<th width="5%" class="title" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Data Entrada', 're.dataEntrada',NULL,NULL  ); ?>
					</th>

					<th width="10%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Data Saída', 're.dataSaida',NULL,NULL  ); ?>
					</th>



				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="11">
						<?php echo $pageNav->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
			<?php
			$k = 0;
			for ($i=0, $n=count($rows); $i < $n; $i++) {
				$row = $rows[$i];

				$link 		= JRoute::_( 'index.php?option=com_hotel&task=edit&cid[]='. $row->id.'&view='.$view );

				$checked 	= JHTML::_('grid.checkedout',   $row, $i );
				$access 	= JHTML::_('grid.access',   $row, $i );
				//$published 	= JHTML::_('grid.published', $row, $i );

				//$row->cat_link 	= JRoute::_( 'index.php?option=com_categories&section=com_hotel_details&task=edit&type=other&cid[]='. $row->catid );
				$row->user_link	= JRoute::_( 'index.php?option=com_users&task=editA&cid[]='. $row->user_id );
				?>
				<tr class="<?php echo "row$k"; ?>">
					<td>
						<?php echo $pageNav->getRowOffset( $i ); ?>
					</td>
					<td>
						<?php echo $checked; ?>
					</td>
                                        <td align="center">
                                        <?php
					if (JTable::isCheckedOut($user->get ('id'), $row->checked_out )) :
						echo htmlspecialchars($row->numApto);
					else :
						?>
						<span class="editlinktip hasTip" title="<?php echo JText::_( 'Editar Reserva' );?>::<?php echo htmlspecialchars($row->numApto); ?>">
						<a href="<?php echo $link; ?>">
							<?php echo "apto Nº ".htmlspecialchars($row->numapto); ?></a> </span>
						<?php
					endif;
					?>


					</td>
                                         <td align="center">

						<?php echo $row->name;?>
					</td>
					<td align="center">
						<?php echo $row->dataReserva;?>
					</td>
                                        <td>
                                            <?php
                                                //$data = date_create($row->dataEntrada);
                                                //$data = date_format($data, 'd/m/Y');

                                            ?>
                                            <?php echo $row->dataEntrada;?>
					</td>
					<td align="center">
                                                <?php echo $row->dataSaida;?>
					</td>

					



				</tr>
				<?php
				$k = 1 - $k;
			}
			?>
			</tbody>
			</table>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />
		<input type="hidden" name="task" value="" />
                <input type="hidden" name="view" value="reservas" />
		<input type="hidden" name="boxchecked" value="0" />

		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}

        function showApartamentos( &$rows, &$pageNav, $option, &$lists )
	{
		$user =& JFactory::getUser();
                $view = JRequest::getcmd('view');

		//Ordering allowed ?
		//$ordering = ($lists['order'] == 'cd.ordering');

		JHTML::_('behavior.tooltip');
		?>
		<form action="index.php?option=com_hotel" method="post" name="adminForm">

		<table>
		<tr>
			<td align="left" width="100%">
				<?php echo JText::_( 'Filter' ); ?>:
				<input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
				<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php
				//echo $lists['catid'];
				echo $lists['state'];
				?>
			</td>
		</tr>
		</table>

			<table class="adminlist">
			<thead>
				<tr>
					<th width="1%">
						<?php echo JText::_( 'Num' ); ?>
					</th>
					<th width="1%" class="title">
						<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" />
					</th>
					<th class="title" width="10%">
						<?php echo JHTML::_('grid.sort',   'Numero', 'ap.num',NULL,NULL ); ?>
					</th>
					<th width="5%" class="title" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Camas de Casal', 'ap.qtdeCamaCasal',NULL,NULL  ); ?>
					</th>

					<th width="8%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Camas de Solteiro', 'ap.qtdeCamaSolteiro',NULL,NULL  ); ?>
					</th>

					<th width="20%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Tipo', 'ap.tipo',NULL,NULL  ); ?>
					</th>
                                        <th width="10%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Ocupado?', 'ap.ocupado',NULL,NULL  ); ?>
					</th>
                                        <th width="10%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Despesas', '',NULL,NULL  ); ?>
					</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="11">
						<?php echo $pageNav->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
			<?php
			$k = 0;
			for ($i=0, $n=count($rows); $i < $n; $i++) {
				$row = $rows[$i];

				$link 		= JRoute::_( 'index.php?option=com_hotel&task=edit&cid[]='. $row->num.'&view='.$view );

				$checked 	= JHTML::_('grid.checkedout',   $row, $i );
				$access 	= JHTML::_('grid.access',   $row, $i );
				//$published 	= JHTML::_('grid.published', $row, $i );
                                if($row->ocupado=='1'){
                                    $published = "Ocupado";
                                }else{
                                    $published = "Desocupado";
                                }
				$row->cat_link 	= JRoute::_( 'index.php?option=com_categories&section=com_hotel_details&task=edit&type=other&cid[]='. $row->catid );
				$row->user_link	= JRoute::_( 'index.php?option=com_users&task=editA&cid[]='. $row->user_id );
				?>
				<tr class="<?php echo "row$k"; ?>">
					<td>
						<?php echo $pageNav->getRowOffset( $i ); ?>
					</td>
					<td>
						<?php echo $checked; ?>
					</td>
					<td>
					<?php
					if (JTable::isCheckedOut($user->get ('num'), $row->checked_out )) :
						echo htmlspecialchars($row->num);
					else :
						?>
						<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Hotel' );?>::<?php echo htmlspecialchars($row->num); ?>">
						<a href="<?php echo $link; ?>">
							<?php echo htmlspecialchars($row->num); ?></a> </span>
						<?php
					endif;
					?>
					</td>
					<td align="center">

						<?php echo $row->qtdeCamaCasal;?>
					</td>

					<td align="center">
						<?php echo $row->qtdeCamaSolteiro;?>
					</td>

					<td align="center">
						<?php echo $row->tipo; ?>
					</td>


					 <td align="center">

						<?php echo $published;?>
					</td>
                                       
                                        <td align="center">
                                            <?php
                                                $link =  "<a href=index.php?option=com_hotel&view=despesas&num=".  $row->num. ">Fazer Lançamento</a>";

                                                if($published!="Ocupado"){
                                                    echo "Fazer Lançamento";
                                                }else{
                                                    echo $link;
                                                }
                                            ?>
                                           
					</td>
				</tr>
				<?php
				$k = 1 - $k;
			}
			?>
			</tbody>
			</table>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />
		<input type="hidden" name="task" value="" />
                <input type="hidden" name="view" value="apartamentos" />
		<input type="hidden" name="boxchecked" value="0" />

		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}
        function showDespesas( &$rows, &$pageNav, $option, &$lists,$idOcupacao )
	{
               
                JRequest::setVar('idOcupacao',$idOcupacao);
		$user =& JFactory::getUser();
                $view = JRequest::getcmd('view');
                $num = JRequest::getcmd('num');
                $db =& JFactory::getDBO();
                $query = 'SELECT SUM(c.valor)
                    FROM conta_consumiveis AS cc
                    INNER JOIN consumiveis AS c ON cc.id_consumiveis = c.id
                    INNER JOIN ocupacao AS o ON o.id = cc.id_ocupacao
                    WHERE o.numApto ='. $num .
                   ' AND o.id = (
                    SELECT max( id )
                    FROM ocupacao
                    WHERE numApto =' . $num . ' )';
               
                $db->setQuery( $query );
                $total = $db->loadResult();


		JHTML::_('behavior.tooltip');
		?>
		<form action="index.php?option=com_hotel" method="post" name="adminForm">

		<table>
		<tr>
			<td align="left" width="100%">
				<?php echo JText::_( 'Filter' ); ?>:
				<input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
				<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php
				//echo $lists['catid'];
				echo $lists['state'];
				?>
			</td>
		</tr>
		</table>

			<table class="adminlist">
			<thead>
				<tr>
					<th width="1%">
						<?php echo JText::_( 'Num' ); ?>
					</th>
					<th width="1%" class="title">
						<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" />
					</th>
					<th class="title" width="10%">
						<?php echo JHTML::_('grid.sort',   'Hora', 'cc.hora',NULL,NULL ); ?>
					</th>
					<th width="5%" class="title" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Descrição', 'c.descricao',NULL,NULL  ); ?>
					</th>

					<th width="8%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Valor', 'c.valor',NULL,NULL  ); ?>
					</th>

					<th width="20%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Tipo', 'c.tipo',NULL,NULL  ); ?>
					</th>
                                        
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="11">
						<?php echo $pageNav->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
			<?php
			$k = 0;
			for ($i=0, $n=count($rows); $i < $n; $i++) {
				$row = $rows[$i];

				$link 		= JRoute::_( 'index.php?option=com_hotel&task=edit&cid[]='. $num.'&view='.$view."&idOcupacao=".$idOcupacao );

				//$checked 	= JHTML::_('grid.checkedout',  $row, $i+1 );
                                $checked = "<input type=\"checkbox\" id=\"cb1\" name=\"cid[]\" value=\"". $row->id_consumiveis ."\" onclick=\"isChecked(this.checked);\" />";
				$access 	= JHTML::_('grid.access',   $row, $i );
				//$published 	= JHTML::_('grid.published', $row, $i );
                               //print_r($checked);

                               //die;
				?>
				<tr class="<?php echo "row$k"; ?>">
					<td>
						<?php echo $pageNav->getRowOffset( $i ); ?>
					</td>
					<td>
						<?php echo $checked; ?>
					</td>
					<td>
					<?php
					if (JTable::isCheckedOut($user->get ('num'), $row->checked_out )) :
						echo htmlspecialchars($row->data);
					else :
						?>
						<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Hotel' );?>::<?php echo htmlspecialchars($row->data); ?>">
						<a href="<?php echo $link; ?>">
							<?php echo htmlspecialchars($row->data); ?></a> </span>
						<?php
					endif;
					?>
					</td>
					<td align="center">

						<?php echo $row->desc;?>
					</td>

					<td align="center">
						<?php echo "R$ ".$row->valor;?>
					</td>

					<td align="center">
						<?php 
                                                if($row->tipo=="P"){
                                                    echo "Produto";
                                                }else{
                                                    echo "Serviço";
                                                }
                                                ?>
					</td>

                                        
				</tr>
				<?php
				$k = 1 - $k;
			}
			?>
                                <tr>
                                    <td colspan="3">
                                       
                                    </td>
                                    <td align="center">
                                       <strong> Total: </strong>
                                    </td>
                                    <td align="center">
                                          R$ <?php echo $total; ?>
                                    </td>
                                    <td align="center">
                                        <a href="index.php?option=com_hotel&view=despesas&task=fecharConta&num=<?php echo $num; ?>">Fechar Conta</a>
                                    </td>
                                </tr>
                                
			</tbody>
			</table>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />
                <input type="hidden" name="idOcupacao" value="<?php echo $idOcupacao; ?>" />
                <input type="hidden" name="num" value="<?php echo $num; ?>" />
		<input type="hidden" name="task" value="" />
                <input type="hidden" name="view" value="despesas" />
		<input type="hidden" name="boxchecked" value="0" />

		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}

	function showHotels( &$rows, &$pageNav, $option, &$lists )
	{
		$user =& JFactory::getUser();

		//Ordering allowed ?
		$ordering = ($lists['order'] == 'cd.ordering');

		JHTML::_('behavior.tooltip');
		?>
		<form action="index.php?option=com_hotel" method="post" name="adminForm">

		<table>
		<tr>
			<td align="left" width="100%">
				<?php echo JText::_( 'Filter' ); ?>:
				<input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
				<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php
				echo $lists['catid'];
				echo $lists['state'];
				?>
			</td>
		</tr>
		</table>

			<table class="adminlist">
			<thead>
				<tr>
					<th width="10">
						<?php echo JText::_( 'Num' ); ?>
					</th>
					<th width="10" class="title">
						<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" />
					</th>
					<th class="title">
						<?php echo JHTML::_('grid.sort',   'Name', 'cd.name', @$lists['order_Dir'], @$lists['order'] ); ?>
					</th>
					<th width="5%" class="title" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Published', 'cd.published', @$lists['order_Dir'], @$lists['order'] ); ?>
					</th>
					<th nowrap="nowrap" width="8%">
						<?php echo JHTML::_('grid.sort',   'Order by', 'cd.ordering', @$lists['order_Dir'], @$lists['order'] ); ?>
						<?php if ($ordering) echo JHTML::_('grid.order',  $rows ); ?>
					</th>
					<th width="8%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'Access', 'cd.access', @$lists['order_Dir'], @$lists['order'] ); ?>
					</th>
					<th width="10%" class="title">
						<?php echo JHTML::_('grid.sort',   'Category', 'category', @$lists['order_Dir'], @$lists['order'] ); ?>
					</th>
					<th class="title" nowrap="nowrap" width="10%">
						<?php echo JHTML::_('grid.sort',   'Linked to User', 'user', @$lists['order_Dir'], @$lists['order'] ); ?>
					</th>
					<th width="1%" nowrap="nowrap">
						<?php echo JHTML::_('grid.sort',   'ID', 'cd.id', @$lists['order_Dir'], @$lists['order'] ); ?>
					</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="11">
						<?php echo $pageNav->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
			<?php
			$k = 0;
			for ($i=0, $n=count($rows); $i < $n; $i++) {
				$row = $rows[$i];

				$link 		= JRoute::_( 'index.php?option=com_hotel&task=edit&cid[]='. $row->id );

				$checked 	= JHTML::_('grid.checkedout',   $row, $i );
				$access 	= JHTML::_('grid.access',   $row, $i );
				$published 	= JHTML::_('grid.published', $row, $i );

				$row->cat_link 	= JRoute::_( 'index.php?option=com_categories&section=com_hotel_details&task=edit&type=other&cid[]='. $row->catid );
				$row->user_link	= JRoute::_( 'index.php?option=com_users&task=editA&cid[]='. $row->user_id );
				?>
				<tr class="<?php echo "row$k"; ?>">
					<td>
						<?php echo $pageNav->getRowOffset( $i ); ?>
					</td>
					<td>
						<?php echo $checked; ?>
					</td>
					<td>
					<?php
					if (JTable::isCheckedOut($user->get ('id'), $row->checked_out )) :
						echo htmlspecialchars($row->name);
					else :
						?>
						<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Hotel' );?>::<?php echo htmlspecialchars($row->name); ?>">
						<a href="<?php echo $link; ?>">
							<?php echo htmlspecialchars($row->name); ?></a> </span>
						<?php
					endif;
					?>
					</td>
					<td align="center">
						<?php echo $published;?>
					</td>
					<td class="order">
						<span><?php echo $pageNav->orderUpIcon( $i, ( $row->catid == @$rows[$i-1]->catid ), 'orderup', 'Move Up', $ordering ); ?></span>
						<span><?php echo $pageNav->orderDownIcon( $i, $n, ( $row->catid == @$rows[$i+1]->catid ), 'orderdown', 'Move Down', $ordering ); ?></span>
						<?php $disabled = $ordering ?  '' : 'disabled="disabled"'; ?>
						<input type="text" name="order[]" size="5" value="<?php echo $row->ordering;?>" <?php echo $disabled ?> class="text_area" style="text-align: center" />
					</td>
					<td align="center">
						<?php echo $access;?>
					</td>
					<td>
						<a href="<?php echo $row->cat_link; ?>" title="<?php echo JText::_( 'Edit Category' ); ?>">
							<?php echo $row->category; ?></a>
					</td>
					<td>
						<a href="<?php echo $row->user_link; ?>" title="<?php echo JText::_( 'Edit User' ); ?>">
							<?php echo $row->user; ?></a>
					</td>
					<td align="center">
						<?php echo $row->id; ?>
					</td>
				</tr>
				<?php
				$k = 1 - $k;
			}
			?>
			</tbody>
			</table>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?>" />
		<input type="hidden" name="filter_order_Dir" value="<?php echo $lists['order_Dir']; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}

	function editConsumiveis( &$row, &$lists, $option, &$params ) {

		JRequest::setVar( 'hidemainmenu', 1 );
                $view = JRequest::getcmd( 'view' );

		if ($row->image == '') {
			$row->image = 'blank.png';
		}

		JHTML::_('behavior.tooltip');
		jimport('joomla.html.pane');
        // TODO: allowAllClose should default true in J!1.6, so remove the array when it does.
		$pane = &JPane::getInstance('sliders', array('allowAllClose' => true));

		JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'misc' );
		$cparams = JComponentHelper::getParams ('com_media');
		?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}

			// do field validation
			if ( form.descricao.value == "" ) {
				alert( "<?php echo JText::_( 'Digite uma descrição.', true ); ?>" );
			} else if ( form.valor.value == '' ) {
				alert( "<?php echo JText::_( 'Digite um preço.', true ); ?>" );
			} else {
				submitform( pressbutton );
			}
		}
		//-->
		</script>

		<form action="index.php" method="post" name="adminForm">

		<div class="col width-60">
			<fieldset class="adminform">
				<legend><?php echo JText::_( 'Details' ); ?></legend>

				<table class="admintable">
				<tr>
					<td class="key">
						<label for="descricao">
							<?php echo JText::_( 'Descricao' ); ?>:
						</label>
					</td>
					<td >
						<input class="inputbox" type="text" name="descricao" id="descricao" size="60" maxlength="255" value="<?php echo $row->descricao; ?>" />
					</td>
				</tr>
				<tr>
					<td class="key">
						<label for="tipo">
							<?php echo JText::_( 'Tipo' ); ?>:
						</label>
					</td>
					<td >
                                            <?php $selected = $row->tipo; ?>
                                            <select id="tipo" name="tipo">
                                                <option value="S" <?php if ($selected == "S"):echo "selected"; endif ?> title="Serviços">Servi&ccedil;os</option>
                                                <option value="P" <?php if ($selected == "P"):echo "selected"; endif ?> title="Produtos">Produtos</option>
                                            </select>
					
					</td>
				</tr>
                                <tr>
					<td class="key">
						<label for="valor">
							<?php echo JText::_( 'Valor' ). " R$"; ?>:
						</label>
					</td>
					<td >
						<input class="inputbox" type="text" name="valor" id="valor" size="60" maxlength="10" value="<?php echo $row->valor; ?>" />
					</td>
				</tr>
				
				
				
				</table>
			</fieldset>

			
		</div>

		
		<div class="clr"></div>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />
		<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
		<input type="hidden" name="cid[]" value="<?php echo $row->id; ?>" />
		<input type="hidden" name="task" value="" />
                <input type="hidden" name="view" value="<?php echo $view; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}

        function editReservas( &$row, &$lists, $option, &$params ) {

		JRequest::setVar( 'hidemainmenu', 1 );
                $view = JRequest::getcmd( 'view' );

		if ($row->image == '') {
			$row->image = 'blank.png';
		}

		JHTML::_('behavior.tooltip');
		jimport('joomla.html.pane');
        // TODO: allowAllClose should default true in J!1.6, so remove the array when it does.
		$pane = &JPane::getInstance('sliders', array('allowAllClose' => true));

		JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'misc' );
		$cparams = JComponentHelper::getParams ('com_media');
		?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}

			// do field validation
                        if( form.cliente.value == 0 ){
                            alert( "<?php echo JText::_( 'Escolha o cliente.', true ); ?>" );
                        } else if ( form.dataEntrada.value == "" ) {
				alert( "<?php echo JText::_( 'Digite uma data de Entrada.', true ); ?>" );
			} else if ( form.dataSaida.value == '' ) {
				alert( "<?php echo JText::_( 'Digite uma data de Saida.', true ); ?>" );
			} else if ( form.numapto.value == '' ) {
				alert( "<?php echo JText::_( 'Digite o num. do Apto.', true ); ?>" );
			} else {
				submitform( pressbutton );
			}
		}
		//-->
		</script>

		<form action="index.php" method="post" name="adminForm">

		<div class="col width-60">
			<fieldset class="adminform">
				<legend><?php echo JText::_( 'Details' ); ?></legend>

				<table class="admintable">
				<tr>
					<td class="key">
						<label for="cliente">
							<?php echo JText::_( 'Cliente' ); ?>:
						</label>
					</td>
					<td >
						<?php echo $lists['clientes']; ?>
					</td>
				</tr>

                                <tr>
					<td class="key">
						<label for="dataEntrada">
							<?php echo JText::_( 'Data Entrada' ); ?>:
						</label>
					</td>
					<td >
                                                <input class="inputbox" type="text" name="dataEntrada" id="valor" size="60" maxlength="10" value="<?php echo $row->dataEntrada; ?>" />

					</td>
				</tr>
                                <tr>
					<td class="key">
						<label for="dataSaida">
							<?php echo JText::_( 'Data Saida' ); ?>:
						</label>
					</td>
					<td >
                                                <input class="inputbox" type="text" name="dataSaida" id="valor" size="60" maxlength="10" value="<?php echo $row->dataSaida; ?>" />

					</td>
				</tr>
                                <tr>
					<td class="key">
						<label for="numApto">
							<?php echo JText::_( 'numApto' ); ?>:
						</label>
					</td>
					<td >
						<input class="inputbox" type="text" name="numapto" id="valor" size="60" maxlength="3" value="<?php echo $row->numapto; ?>" />
					</td>
				</tr>



				</table>
			</fieldset>


		</div>


		<div class="clr"></div>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />
		<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
		<input type="hidden" name="cid[]" value="<?php echo $row->id; ?>" />
                <input type="hidden" name="dataReserva" value="<?php echo date("d/m/Y") ?>" />
		<input type="hidden" name="task" value="" />
                <input type="hidden" name="view" value="<?php echo $view; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}

        function editApartamentos( &$row, &$lists, $option, &$params ) {

		JRequest::setVar( 'hidemainmenu', 1 );
                $view = JRequest::getcmd( 'view' );

		if ($row->image == '') {
			$row->image = 'blank.png';
		}

		JHTML::_('behavior.tooltip');
		jimport('joomla.html.pane');
        // TODO: allowAllClose should default true in J!1.6, so remove the array when it does.
		$pane = &JPane::getInstance('sliders', array('allowAllClose' => true));

		JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'misc' );
		$cparams = JComponentHelper::getParams ('com_media');
		?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}

			// do field validation
                        if( form.num.value == 0 ){
                            alert( "<?php echo JText::_( 'Escolha o Numero do Apto.', true ); ?>" );
                        }  else {
				submitform( pressbutton );
			}
		}
		//-->
		</script>

		<form action="index.php" method="post" name="adminForm">

		<div class="col width-60">
			<fieldset class="adminform">
				<legend><?php echo JText::_( 'Details' ); ?></legend>

				<table class="admintable">
				<tr>
					<td class="key">
						<label for="num">
							<?php echo JText::_( 'Numero' ); ?>:
						</label>
					</td>
					<td >
						 <input class="inputbox" type="text" name="num" id="num" size="30" maxlength="3" value="<?php echo $row->num; ?>" />

					</td>
				</tr>

                                <tr>
					<td class="key">
						<label for="dataEntrada">
							<?php echo JText::_( 'Qtd. Camas de Casal' ); ?>:
						</label>
					</td>
					<td >
                                                <input class="inputbox" type="text" name="qtdeCamaCasal" id="qtdeCamaCasal" size="30" maxlength="2" value="<?php echo $row->qtdeCamaCasal; ?>" />

					</td>
				</tr>
                                <tr>
					<td class="key">
						<label for="dataEntrada">
							<?php echo JText::_( 'Qtd. Camas de Solteiro' ); ?>:
						</label>
					</td>
					<td >
                                                <input class="inputbox" type="text" name="qtdeCamaSolteiro" id="qtdeCamaSolteiro" size="30" maxlength="2" value="<?php echo $row->qtdeCamaSolteiro; ?>" />

					</td>
				</tr>
                                <tr>
					<td class="key">
						<label for="tipo">
							<?php echo JText::_( 'Tipo' ); ?>:
						</label>
					</td>
					<td >
                                                <input class="inputbox" type="text" name="tipo" id="Tipo" size="60" maxlength="20" value="<?php echo $row->tipo; ?>" />

					</td>
				</tr>
                                



				</table>
			</fieldset>


		</div>


		<div class="clr"></div>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />
		
                <input type="hidden" name="ocupado" value="<?php echo $row->ocupado; ?>" />
		<input type="hidden" name="cid[]" value="<?php echo $row->num; ?>" />
                
		<input type="hidden" name="task" value="" />
                <input type="hidden" name="view" value="<?php echo $view; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}

        function editDespesa($numApto,$idOcupacao,$consumiveis,$option) {

		JRequest::setVar( 'hidemainmenu', 1 );
                $view = JRequest::getcmd( 'view' );

		JHTML::_('behavior.tooltip');
		jimport('joomla.html.pane');
        
		$pane = &JPane::getInstance('sliders', array('allowAllClose' => true));

		JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'misc' );
		$cparams = JComponentHelper::getParams ('com_media');
		?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}

			// do field validation
                        if( form.consumiveis.value == 0 ){
                            alert( "<?php echo JText::_( 'Escolha o Consumivel.', true ); ?>" );
                        }  else {
				submitform( pressbutton );
			}
		}
		//-->
		</script>

		<form action="index.php" method="post" name="adminForm">

		<div class="col width-60">
			<fieldset class="adminform">
				<legend><?php echo JText::_( 'Details' ); ?></legend>

				<table class="admintable">
				<tr>
					<td class="key">
						<label for="consumiveis">
							<?php echo JText::_( 'Produto/Serviço' ); ?>:
						</label>
					</td>
					<td >
						 <?php echo $consumiveis; ?>
					</td>
				</tr>

                                




				</table>
			</fieldset>


		</div>


		<div class="clr"></div>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />

                <input type="hidden" name="id_ocupacao" value="<?php echo $idOcupacao; ?>" />
		<input type="hidden" name="num" value="<?php echo $numApto; ?>" />

		<input type="hidden" name="task" value="" />
                <input type="hidden" name="view" value="<?php echo $view; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}

         function editConta($rows, $option, $lists, $idOcupacao) {

		JRequest::setVar( 'hidemainmenu', 1 );
                JRequest::setVar( 'task', 'edit' );
                $view = JRequest::getcmd( 'view' );
                $num = JRequest::getcmd('num');
                $db =& JFactory::getDBO();
                $query = 'SELECT SUM(c.valor)
                    FROM conta_consumiveis AS cc
                    INNER JOIN consumiveis AS c ON cc.id_consumiveis = c.id
                    INNER JOIN ocupacao AS o ON o.id = cc.id_ocupacao
                    WHERE o.numApto ='. $num .
                   ' AND o.id = (
                    SELECT max( id )
                    FROM ocupacao
                    WHERE numApto =' . $num . ' )';

                $db->setQuery( $query );
                $total = $db->loadResult();

		JHTML::_('behavior.tooltip');
		jimport('joomla.html.pane');

		$pane = &JPane::getInstance('sliders', array('allowAllClose' => true));

		JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'misc' );
		$cparams = JComponentHelper::getParams ('com_media');
		?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}

			// do field validation
                        if( form.formaPgto.value == 0 ){
                            alert( "<?php echo JText::_( 'Escolha a Forma de pagamento.', true ); ?>" );
                        }  else {
				submitform( pressbutton );
			}
		}
		//-->
		</script>

		<form action="index.php" method="post" name="adminForm">

		<div class="col width-60">
			<fieldset class="adminform">
				<legend><?php echo JText::_( 'Details' ); ?></legend>

				<table class="admintable">
				<tr>
					<td class="key">
						<label for="consumiveis">
							<?php echo JText::_( 'Forma de Pagamento' ); ?>:
						</label>
					</td>
					<td >
						 <select id="formaPgto" class="inputbox" name="formaPgto">
                                                     <option value="0" selected>Forma de pagamento</option>
                                                     <option value="dinheiro">A vista</option>
                                                     <option value="cartao">Cartão</option>
                                                 </select>
					</td>
				</tr>
                                <tr>
                                    <td class="key">
                                        Detalhamento:
                                    </td>
                                    <td>
                                        <?php
                                            foreach($rows as $row){
                                                $date = date_create($row->data);
                                                echo date_format( $date, "d/m/y : h:m")." - ".$row->desc." -> ".$row->valor."<br />";
                                            }

                                        ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Total
                                    </td>
                                    <td >
                                       <strong><?php echo "R$ ".$total; ?></strong>
                                    </td>
                                </tr>



				</table>
			</fieldset>


		</div>


		<div class="clr"></div>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />

                <input type="hidden" name="id_ocupacao" value="<?php echo $idOcupacao; ?>" />
		<input type="hidden" name="num" value="<?php echo $num; ?>" />
                <input type="hidden" name="task" value="save" />
		<input type="hidden" name="task2" value="saveConta" />
                <input type="hidden" name="view" value="<?php echo $view; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}

        function editOcupacoes( &$row, &$lists, $option, &$params ) {
                
		JRequest::setVar( 'hidemainmenu', 1 );
                $view = "ocupacoes";

		if ($row->image == '') {
			$row->image = 'blank.png';
		}

		JHTML::_('behavior.tooltip');
		jimport('joomla.html.pane');
        // TODO: allowAllClose should default true in J!1.6, so remove the array when it does.
		$pane = &JPane::getInstance('sliders', array('allowAllClose' => true));

		JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'misc' );
		$cparams = JComponentHelper::getParams ('com_media');
		?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}

			// do field validation
                        if ( form.numApto.value == '' ){
                            alert( "<?php echo JText::_( 'Preencha o numero do apartamento.', true ); ?>" );
                        }else if( form.qtdePessoas.value == '' ){
                            alert( "<?php echo JText::_( 'Preencha a quantidade de pessoas a ocupar o quarto.', true ); ?>" );
                        }else if ( form.dataSaida.value == '' ){
				alert( "<?php echo JText::_( 'Preencha uma data de saida.', true ); ?>" );
			}else if( form.cliente.value == 0 ){
                            alert( "<?php echo JText::_( 'Escolha o cliente.', true ); ?>" );
                        }  else {
				submitform( pressbutton );
			}
		}
		//-->
		</script>

		<form action="index.php" method="post" name="adminForm">

		<div class="col width-60">
			<fieldset class="adminform">
				<legend><?php echo JText::_( 'Check-in' ); ?></legend>

				<table class="admintable">
				<tr>
					<td class="key">
						<label for="numapto">
							<?php echo JText::_( 'Num. Apto' ); ?>:
						</label>
					</td>
					<td >
						<input class="inputbox" type="text" name="numApto" id="numApto" size="3" maxlength="3" value="<?php echo $row->numApto; ?>" />
					</td>
				</tr>
				<tr>
					<td class="key">
						<label for="tipo">
							<?php echo JText::_( 'Cliente' ); ?>:
						</label>
					</td>
					<td >
                                            <?php echo $lists['clientes']; ?>

					</td>
				</tr>
                                <tr>
					<td class="key">
						<label for="qtdepessoas">
							<?php echo JText::_( 'Qtd. Pessoas' ); ?>:
						</label>
					</td>
					<td >
						<input class="inputbox" type="text" name="qtdePessoas" id="qtdePessoas" size="3" maxlength="3" value="<?php echo $row->qtdePessoas; ?>" />
					</td>
				</tr>
                                
                                 <tr>
					<td class="key">
						<label for="datasaida">
							<?php echo JText::_( 'Dt.Saida' ); ?>:
						</label>
					</td>
					<td >
						<input class="inputbox" type="text" name="dataSaida" id="dataSaida" size="20" maxlength="10" value="<?php echo $row->dataSaida; ?>" />
					</td>
				</tr>



				</table>
			</fieldset>


		</div>


		<div class="clr"></div>

		<input type="hidden" name="option" value="<?php echo $option; ?>" />
		<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
		<input type="hidden" name="cid[]" value="<?php echo $row->id; ?>" />
                <input type="hidden" name="dataEntrada" value="<?php if($row->dataEntrada==''): echo date("d/m/y") ; else: echo $row->dataEntrada; endif;?>" />

		<input type="hidden" name="task" value="" />
                <input type="hidden" name="view" value="<?php echo $view; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}
}